package com.commodity.Service.warehouseServiceImp;

import com.commodity.Dao.WarehouseDao;
import com.commodity.Dao.warehouseDaoImp.WareHouseDaoImp;
import com.commodity.Service.WarehouseService;
import com.commodity.entity.Warehouse;
import com.commodity.entity.WarehouseSearchBean;
import com.commodity.utils.BeanFactory;
import com.commodity.utils.PaginateInfo;

import java.util.List;

public class WarehouseServiceImp implements WarehouseService {
    private final WarehouseDao warehouseDao = BeanFactory.getInstance(WareHouseDaoImp.class);

    @Override
    public List<Warehouse> findAll(WarehouseSearchBean wsb, PaginateInfo pi) {
        return warehouseDao.findAll(wsb, pi);
    }

    @Override
    public boolean add(Warehouse warehouse) {
        return warehouseDao.add(warehouse) > 0;
    }

    @Override
    public int deleteByIds(Integer[] intIds) {
        return warehouseDao.deleteByIds(intIds);
    }

    @Override
    public Warehouse findById(Integer id) {
        return warehouseDao.findById(id);
    }

    @Override
    public boolean update(Warehouse warehouse) {
        return warehouseDao.update(warehouse)>0;
    }
}
